import request from '@/utils/request.js'

// 词类列表
export const wordList = (data) => {
    return request({
        url: '/word/list',
        method: 'post',
        data: data
    })
}

// 新增词类
export const addWord = (data) => {
    return request({
        url: '/word',
        method: 'post',
        data: data
    })
}

// 词类详情
export const wordDetail = (id) => {
    return request({
        url: '/word/'  + id,
        method: 'get',
    })
}

// 修改词类
export const wordEdit = (data) => {
    return request({
        url: '/word',
        method: 'put',
        data: data
    })
}

// 词类删除
export const wordRowDel = (id) => {
    return request({
        url: `/word/${id}`,
        method: 'delete'
    })
}

// 词类批量删除
export const wordsDel = (ids) => {
    return request({
        url: `/word/batchDelete`,
        method: 'delete',
        data: ids
    })
}

// 批量导出
export const wordExport = (data)=> {
    return request({
        url: `/word/export`,
        method: 'post',
        data: data,
        responseType: 'blob'//处理乱码问题，转化为blob类型
    })
}

// 下载词类导入模板
export const wordReload = () => {
    return request({
        url: '/word/reload',
        method:'post',
        headers:{'Content-Type':'multipart/form-data'},
        responseType: 'blob',
    })
}
